<!doctype html>
<!--
@license
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>

<head>
  <title>Test full bundle and modules</title>
  <meta charset="UTF-8">
  <script src="./wct-config.js"></script>
  <script>window.callback = null; WCT.waitFor = (cb) => { window.callback = cb; }</script>
  <script src="../node_modules/wct-browser-legacy/browser.js"></script>
</head>

<body>
  <module-a id="parsed"></module-a>
  <script>
    function assertComputed(element, expected, prop = 'border-top-width') {
      assert.equal(getComputedStyle(element).getPropertyValue(prop).trim(), expected);
    }
    suite('late everything', function () {
      test('element upgraded', function () {
        let el = document.querySelector('#parsed');
        let moduleA = customElements.get('module-a');
        assert.instanceOf(el, moduleA);
      });
    });
  </script>
  <script>
    addEventListener('load', () => {
      const script = document.createElement('script');
      script.src = '../webcomponents-bundle.js';
      addEventListener('WebComponentsReady', () => {
        customElements.define('module-a', class extends HTMLElement { });
        window.callback();
      });
      document.body.appendChild(script);
    })
  </script>
</body>

</html>